Skip to content

Support query-parameter auth (refs #5) - #6

Merged
aezell merged 2 commits into
mainfrom
query-auth
Oct 15, 2026
Merged

aezell merged 2 commits into
mainfrom
query-auth

Conversation

@aezell

@aezell aezell commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Refs #5.

Mirrors query-parameter auth from superfly/sprites-api#1574 into the manifest format, the probe runner and the contributor guide. A connector may now declare

"auth": {"query": "token"}

Depends on sprites-api PR superfly/sprites-api#1574 being released. The format and tooling accept the form today, but a query-auth connector (Pushover) cannot ship from this repository until the gateway that understands it is live.

What changed

  • v1/schema.json: copied from priv/connectors/schema.json on the sprites-api branch. The auth definition gains the {"query": name} object (name matching ^[^\s=&%]+$) and descriptions. The copy here had also fallen behind sprites-api main, so the same diff brings in examples being required with at least one entry, the probe.expect-or-hooks rule, and the tier, owner and source_url fields. Every example, the Notion connector and the template validate against it.
  • scripts/lib/credential.mjs (new): the key placement shared by the runner and the checks. For the query form it strips every parameter of that name from the query string (keys decoded for the comparison, so %74oken counts; other pairs keep the caller's encoding) and appends name=<key> x-www-form-urlencoded. Also redactText / holdsKey, which cover the key as typed and URL-encoded.
  • scripts/probe.mjs: honours auth.query; sends no credential header for it; redirects stay off and there are still no retries. The request line it prints, every error and the written fixture pass through redaction, so neither the raw nor the encoded key appears, including when the API echoes the request URL in a body or header. The command body moved into an exported run(argv, {root, env, log, error}) so it can be tested end to end on a sandbox root; the CLI behaviour and exit codes are unchanged.
  • scripts/lib/manifest.mjs: manifestProblems reports an auth that is not one of the three forms in words, so check-connectors.mjs says what is wrong without ajv.
  • Tests: scripts/test/credential.test.mjs (the gateway's own query-string, encoding and redaction cases), query-auth cases in probe.test.mjs against the local http.createServer stub (the server sees exactly one token parameter with the key although the probe path carried token=wrong, no Authorization header, and neither the printed output nor the written fixture holds the key raw or encoded, also on a transport error), and an auth case in manifest.test.mjs. 47 tests pass on Node 22.
  • CONTRIBUTING.md: documents {"query": "token"}, that Sprites replaces any parameter of that name the Sprite sends rather than appending, that the key then appears in the request URL so the connector's notices should say so, and that connectors whose API echoes request URLs in error bodies set gateway_error_messages to false. The "cannot do" list now reads bearer token, fixed header or query parameter.
  • Not changed: v1/vectors.json has no auth cases; the template does not explain auth, so it was left alone.

Checks run

  • node --test "scripts/test/*.test.mjs": 47 pass
  • node scripts/check-connectors.mjs: 12 connector(s) ok
  • the workflow's ajv step over examples/*, connectors/* and the template: all valid

Mirrors sprites-api's query credential: auth may be {"query": name}. The
probe runner strips every parameter of that name from the probe path,
appends its own URL-encoded, sends no credential header and redacts the
key, raw and encoded, from everything it prints or records. The schema
copy also catches up with examples being required and the tier, owner and
source_url fields. Refs #5.
An API that echoes the request URL may lowercase or mix the case of
percent escapes, so %2b survived a match on %2B and a usable key could
reach a fixture. One case-insensitive matcher now covers the key as typed,
form-encoded and URI-encoded, in holdsKey and redactText alike.
@aezell
aezell merged commit 3e6d9e3 into main Oct 15, 2026
3 checks passed
@aezell
aezell deleted the query-auth branch October 15, 2026 14:08
aezell pushed a commit that referenced this pull request Oct 19, 2026
* Add Pushover community connector

Sends notifications through Pushover with the application token injected
as the token query parameter (#5, #6). Forwards POST /1/messages.json,
POST /1/users/validate.json, GET /1/apps/limits.json (the probe) and
GET /1/receipts/:receipt.json. The recipient's user key stays with the
Sprite. Probe recordings for a good and a wrong token are under
fixtures/pushover/.

* Keep Pushover's colours in the mark

Pushover's logo terms do not allow changing its colours, so mark.svg is
now the full-colour logo, identical to icon.svg, rather than a
currentColor rendering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant